#include "StdAfx.h"
#include "AutoWaitCursor.h"


HCURSOR CAutoWaitCursor::m_hWait = NULL;
HCURSOR CAutoWaitCursor::m_hNormal = NULL;

//::LoadCursor(m_hAppInstance,IDC_ARROW)
void CAutoWaitCursor::BeginWaitCursor()
{
	if(m_hWait == NULL)
	{
		SetupCursors();
	}
	::SetCursor(m_hWait);
}

void CAutoWaitCursor::EndWaitCursor()
{
	::SetCursor(m_hNormal);
}

BOOL CAutoWaitCursor::SetupCursors( HCURSOR HWait /*= ::LoadCursor(AfxGetInstanceHandle(),IDC_WAIT)*/, HCURSOR HNor /*= ::LoadCursor(AfxGetInstanceHandle(),IDC_ARROW) */ )
{
	m_hWait = HWait;
	m_hNormal = HNor;
	return HWait != NULL && HNor != NULL;
}

CAutoWaitCursor::~CAutoWaitCursor()
{
	EndWaitCursor();
}

CAutoWaitCursor::CAutoWaitCursor()
{
	BeginWaitCursor();
}
